package com.test.exception;

import lombok.Getter;

import java.text.SimpleDateFormat;
import java.util.Date;

@Getter
public class ExceptionResult {
    private int status;
    private String message;
    private String timestamp;

    //定义异常返回的显示格式,以及显示信息
    public ExceptionResult(MyException e) {
        this.status = e.getStatus();
        this.message = e.getMessage();
        //来源于 jodatime 工具包  也可自己设置
        this.timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
    }
}